package com.jungle.mvvm.net;

import io.reactivex.Observer;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;

/**
 * 详细说明
 *
 * @author Daniel
 * @version V1.0
 * @date 2020/12/25 15:02
 */
public abstract class BaseObserver<T> implements Observer<T> {

    @Override
    public void onSubscribe(@NonNull Disposable d) {
    }

    @Override
    public void onNext(@NonNull T t) {
        onSuccess(t);
    }

    @Override
    public void onError(@NonNull Throwable e) {
        onFailure(e);
    }

    @Override
    public void onComplete() {
    }

    /**
     * 成功回调
     *
     * @param t
     */
    public abstract void onSuccess(T t);

    /**
     * 失败回调
     *
     * @param e
     */
    public abstract void onFailure(Throwable e);
}
